<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>查询关于网络实体的信息树</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.snmpwalkoid" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">snmpwalkoid</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">snmpwalkoid</span> &mdash; <span class="dc-title">查询关于网络实体的信息树</span></p>

 </div>
 <div class="refsect1 unknown-unknown-unknown-seealsr" id="refsect1-function.snmpwalkoid-unknown-unknown-unknown-seealsr">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>snmpwalkoid</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$hostname</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$community</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$object_id</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$retries</code></span>
  ]] ) : <span class="type">array</span></div>


  <p class="para rdfs-comment">
   返回一个包含对象 id 及它们各自对象值的关联数组，这些对象以 
   <code class="parameter">object_id</code> 作为根，错误则返回 <strong><code>FALSE</code></strong>。
  </p>

  <p class="para">
   <span class="function"><strong>snmpwalkoid()</strong></span> 用于从
   <code class="parameter">hostname</code> 所指定的 SNMP 
   代理那里读取所有对象 id 及它们各自的值。<code class="parameter">community</code>
   指定对于该代理有读权限的域。一个为 <strong><code>NULL</code></strong>
   的 <code class="parameter">object_id</code> 将被看作 
   SNMP 对象树的根，而在此树下的所有对象将作为一个数组被返回。如果指定了
   <code class="parameter">object_id</code>，则返回所有在
   <code class="parameter">object_id</code> 下的 SNMP 对象。
  </p>

  <p class="para">
   <span class="function"><strong>snmpwalkoid()</strong></span> 和
   <span class="function"><a href="snmpwalk.html" class="function">snmpwalk()</a></span> 的同时存在出于历史原因。提供两个函数是为了向后兼容。
   <div class="informalexample">
    <div class="example-contents"> 
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$a&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">snmpwalkoid</span><span style="color: #007700">(</span><span style="color: #DD0000">"127.0.0.1"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"public"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p> 

  <p class="para">
   上边的函数调用将从运行于本机的 SNMP 
   代理那里返回所有的 SNMP 对象。可使用循环遍历这些值。
   <div class="informalexample">
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">for&nbsp;(</span><span style="color: #0000BB">reset</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">key</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">next</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$i</span><span style="color: #DD0000">:&nbsp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">]</span><span style="color: #DD0000">&lt;br&nbsp;/&gt;\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>

</div></div></div></body></html>